//
//  ShowViewController.swift
//  JunCodeDemo
//
//  Created by iOS_Tian on 2017/11/16.
//  Copyright © 2017年 CoderJun. All rights reserved.
//

import UIKit
import WebKit
class ShowViewController: UIViewController {
     var webView: WKWebView!
    
    var scanDataArr = [String]()
    
   
    override func viewDidLoad() {
        super.viewDidLoad()
        webView = WKWebView(frame: view.bounds)
        view.addSubview(webView)
        title = "扫码结果"
        var result = ""
        if scanDataArr.count >= 3 {
            result = scanDataArr[2]
        }else if scanDataArr.count == 2{
            result = scanDataArr[1]

        }else if scanDataArr.count == 1 {
            result = scanDataArr[0]
        }
        result = result.replacingOccurrences(of: "\n", with: "")
        
        if let url = URL(string: result) {
            webView.load(URLRequest(url: url))
        }
    }
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        webView.frame = view.bounds
    }
}
